//
//  AppDelegate.m
//  Study1
//
//  Created by ChenJie on 2/3/20.
//  Copyright © 2020 OrgName. All rights reserved.
//

#import "AppDelegate.h"
#import "ViewController.h"
#import "Person.h"
#import "OneViewController.h"
#import "TwoViewController.h"
#import "ThreeViewController.h"
#import "FourViewController.h"
#import "FiveViewController.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
    // alloc-init
    self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    
    UITabBarController *mainFrame = [[UITabBarController alloc] init];

    //
    OneViewController *oneVc = [[OneViewController alloc] init];
    UINavigationController *oneNav = [[UINavigationController alloc] initWithRootViewController:oneVc];
    oneVc.tabBarItem.title = @"One";
    oneVc.tabBarItem.image = [UIImage imageNamed:@"1"];

    //
    TwoViewController *twoVc = [[TwoViewController alloc] init];
    UINavigationController *twoNav = [[UINavigationController alloc] initWithRootViewController:twoVc];
    twoVc.tabBarItem.title = @"Two";
    twoVc.tabBarItem.image = [UIImage imageNamed:@"2"];

    //
    ThreeViewController *threeVc = [[ThreeViewController alloc] init];
    UINavigationController *threeNav = [[UINavigationController alloc] initWithRootViewController:threeVc];
    threeVc.tabBarItem.title = @"Three";
    threeVc.tabBarItem.image = [UIImage imageNamed:@"3"];

    //
    FourViewController *fourVc = [[FourViewController alloc] init];
    UINavigationController *fourNav = [[UINavigationController alloc] initWithRootViewController:fourVc];
    fourVc.tabBarItem.title = @"Four";
    fourVc.tabBarItem.image = [UIImage imageNamed:@"4"];
    
    //
    FiveViewController *fiveVc = [[FiveViewController alloc] init];
    UINavigationController *fiveNav = [[UINavigationController alloc] initWithRootViewController:fiveVc];
    fiveVc.tabBarItem.title = @"Five";
    fiveVc.tabBarItem.image = [UIImage imageNamed:@"5"];

    mainFrame.viewControllers = @[oneNav, twoNav, threeNav, fourNav, fiveNav];
    self.window.rootViewController = mainFrame;

    mainFrame.selectedIndex = 1;
    
    
    // visible
    [self.window makeKeyAndVisible];
    
    
    //
//    Person *person1 = [[Person alloc] initWithName:@"li"
//                                               age:20
//                                          greeting:@"hello!"];
////    person1.name = @"zhang";
//    NSLog(@"name is: %@", person1.name);
//
    
    
    
    return YES;
}

@end
